﻿<?php 
defined('_JEXEC') or die('Accès interdit'); 
?>

	
	<link rel="stylesheet" type="text/css" href="components/com_tournoi/plugins/jquery_ui_multiselect/css/common.css">	
	<link rel="stylesheet" type="text/css" href="components/com_tournoi/plugins/jquery_ui/css/jquery-ui-1.8.21.custom.css" />
	<link rel="stylesheet" type="text/css" href="components/com_tournoi/plugins/jquery_ui_multiselect/css/ui.multiselect.css">


	<script src="components/com_tournoi/plugins/jquery/jquery-1.7.2.min.js"></script>
	<script src="components/com_tournoi/plugins/jquery_ui/jquery-ui-1.8.21.custom.min.js" type="text/javascript"></script>
	<script src="components/com_tournoi/plugins/jquery/i18n/grid.locale-fr.js" type="text/javascript"></script>
	<script src="components/com_tournoi/plugins/jquery_ui_multiselect/ui.multiselect.js" type="text/javascript"></script>
	
	
	
<script>
$(function() {
	$( "#datedebut" ).datepicker();
	$( "#datedebut" ).datepicker( "option", "dateFormat", 'dd/mm/yy' );
	$( "#datedebut" ).datepicker({showOn: "button",buttonImage: "images/calendar.gif",	buttonImageOnly: true});
	$( "#datedebut" ).datepicker({ autoSize: true });
	$( "#tabs" ).tabs();
	$('.numbersOnly').keyup(function () {this.value = this.value.replace(/[^0-9\.]/g,'')});
	$('.heureOnly').keyup(function () {this.value = this.value.replace(/[^0-9\:]/g,'')});
	$(".multiselect").css('width', '600px');		
    $(".multiselect").multiselect({sortable: false, searchable: true, dividerLocation: 0.5});
	

});
</script>			
	
<script type="text/javascript">	
	function changeRecave()
	{	
		if (document.getElementById('recave').selectedIndex == '1')
		{
			document.getElementById('jetonRecave').disabled=false;
			document.getElementById('montantRecave').disabled=false;
		}
		else
		{
			document.getElementById('jetonRecave').value="";
			document.getElementById('jetonRecave').disabled=true;
			document.getElementById('montantRecave').value="";
			document.getElementById('montantRecave').disabled=true;
		}			
		
	}

	function changeAddOn()
	{	
		if (document.getElementById('addOn').selectedIndex == '1')
		{
			document.getElementById('jetonAddon').disabled=false;
			document.getElementById('montantAddon').disabled=false;
		}
		else
		{
			document.getElementById('jetonAddon').value="";
			document.getElementById('jetonAddon').disabled=true;
			document.getElementById('montantAddon').value="";
			document.getElementById('montantAddon').disabled=true;			
		}			
	}
</script>	
			
<div class="component_simplethu">
	<h1 class="componentheading">Créer</h1>
	<form action="index.php?option=com_tournoi&task=creation" method="post">
		<div id="tabs">
			<ul>
				<li><a href="#tabs-1">Informations générales</a></li>
				<li><a href="#tabs-2">Informations tournois</a></li>
				<li><a href="#tabs-3">Participants</a></li>
				<li><a href="#tabs-4">Description</a></li>				
			</ul>
			<div id="tabs-1">
				<br>
				<br>
				Titre :&nbsp;&nbsp;&nbsp;<input alt="Titre du tournoi" name="titre"
				 size="75">
				<br>
				<br>
				Lieu :&nbsp;&nbsp;&nbsp; <input alt="Lieu physique du tournoi"
				 name="lieu" size="75">
				<br>
				<br>
				Date :&nbsp;&nbsp; <input type="text" id="datedebut" name="datedebut" size="23">
				&nbsp;&nbsp; Heure :&nbsp;&nbsp;&nbsp; <input alt="Heure de d&eacute;but du tournoi" class="heureOnly" name="heuredebut" size="23">				
			</div>
			<div id="tabs-2">
				<br>
				<br>
				Variantes :&nbsp;  <select name="variantes">
				<?php
				// boucle d'affichage de toutes les variantes
				foreach($this->variantes as $variante) {
				?>
				<option value="<?php echo $variante->id ?>"><?php echo $variante->nom ?></option>			
				<?php
				}
				?>
				</select>
				&nbsp;&nbsp;&nbsp; Buy in :&nbsp; <input alt="Montant d'entrée du tournoi" class="numbersOnly" name="buyIn" size="15">

				&nbsp;&nbsp;&nbsp; Tapis de départ :&nbsp; <input name="tapisDepart" class="numbersOnly" size="15">
				<br>
				<br>
				Recave :&nbsp;&nbsp;&nbsp;&nbsp;  <select name="recave"  id="recave" onchange="javascript:changeRecave()">
							  <option selected value="0">Non</option>
							  <option value="1">Oui</option>
							</select>

				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Montant recave :&nbsp; <input name="montantRecave" id="montantRecave" class="numbersOnly" size="15" disabled='true'>

				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Jetons recave :&nbsp; <input name="jetonRecave" id="jetonRecave" size="15" class="numbersOnly" disabled='true'>
				<br>
				<br>				
				
				Add on :&nbsp;&nbsp;&nbsp;&nbsp;  <select name='addOn' id='addOn' onchange="javascript:changeAddOn()">
							  <option selected value="0">Non</option>
							  <option value="1">Oui</option>
							</select>
							
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Montant add on :&nbsp; <input name="montantAddon" id="montantAddon" class="numbersOnly" size="15" disabled='true'>
				
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Jetons add on :&nbsp; <input name="jetonAddon" id="jetonAddon" class="numbersOnly" size="15" disabled='true'>
				<br>
				<br>
			</div>
			<div id="tabs-3">
				<select name="participants[]" class="multiselect" id="participants" multiple="multiple" >
				<?php
				// boucle d'affichage de tous les users
				foreach($this->users as $user) {
				?>
				<option value="<?php echo $user->id ?>"><?php echo $user->username ?></option>			
				<?php
				}
				?>
				</select>
			</div>
			<div id="tabs-4">
				<br>
					<textarea name="description" id="description" rows="10" cols="93"></textarea>
				<br>
			</div>			
		</div>
		<br>
		<input name="submit" id="btn_creer" value="Cr&eacute;er" type="submit">
	</form>
</div>
